package com.mall.admin.controller;

import com.mall.admin.service.PmsSkuStockService;
import com.mall.commons.utils.R;
import com.mall.domain.PmsSkuStock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/sku")
public class PmsSkuStockController {

    @Autowired
    private PmsSkuStockService pmsSkuStockService;

    //批量更新sku库存信息
    @PostMapping("/update/{pid}")
    public R updateSku(@PathVariable Long pid, @RequestBody List<PmsSkuStock> skuStockList){
        return pmsSkuStockService.updateSku(pid,skuStockList);
    }

    //根据商品ID及sku编码模糊搜索sku库存
    @GetMapping("/{pid}")
    public R searchSku(@PathVariable Long pid, String keyword){
        return pmsSkuStockService.searchSku(pid,keyword);
    }

}
